/*
 * @Description:
 * @Version: 1.0
 * @Autor: gaoluo
 * @Date: 2022-05-23 11:39:27
 * @LastEditors: gaoluo
 * @LastEditTime: 2022-07-07 15:33:48
 * @FilePath: /vue3.0-vite-ts-xiaotuxian/src/api/login.ts
 */

import request from "./index";
interface Response {
  msg: string;
  state: string;
  code: number;
}

type UserInfo = {
  username: string;
  password: string;
};

type Uakey = {
  uakey: string;
};

interface IToken extends Response {
  data: {
    token: string;
  };
}

export async function login(params: UserInfo) {
  return await request.get("/login", {
    params,
  });
}

export async function getToken(params: Uakey): Promise<IToken> {
  return await request.get("/token", {
    params,
  });
}
